package factory

import java.util.function.{Function, Predicate}

import dto.req.{CloseOrderReqDTO, NotifyReqDTO, PayOrderReqDTO}
import dto.resp.{CloseOrderRespDTO, PayOrderRespDTO}

trait PayAction {

  @throws[Exception]
  def checkParams[T <: PayOrderReqDTO](req: T): Unit

  @throws[Exception]
  def buildOrder[T <: PayOrderReqDTO, R >: PayOrderRespDTO](req: T): R

  def payTransaction(req:PayOrderRespDTO, function:Function[PayOrderRespDTO,PayOrderRespDTO]):PayOrderRespDTO

  def pay[T <: PayOrderReqDTO](req: T): Unit

  @throws[Exception]
  def closeOrder[T <: CloseOrderReqDTO, R >: CloseOrderRespDTO](req: T): R

  def callback(req: NotifyReqDTO, predicate: Predicate[NotifyReqDTO]): Boolean

  def setProperties(bizCode: String): Unit

  def getPayChannel: Integer
}
